//
//  MyViewController.m
//  drug
//
//  Created by 沈鑫 on 16/4/5.
//  Copyright © 2016年 沈鑫. All rights reserved.
//

#import "MyViewController.h"
#import "MyCell.h"
#import "RemindViewController.h"
#import "AboutViewController.h"
@interface MyViewController ()<UITableViewDelegate, UITableViewDataSource>

@property (nonatomic, strong)UIImageView *myImageView;

@property (nonatomic, strong)UIImageView *myImageView1;

@property (nonatomic, strong)UITableView *tableView;

@property (nonatomic, strong)UIImageView *pngImageView;
@end

@implementation MyViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    // 开工了
    
  //  self.navigationController.navigationBar.translucent = NO;
    self.navigationItem.title = @"我的";
    
    // navigation两边button 的颜色
    // [self.navigationController.navigationBar setTintColor:[UIColor blackColor]];
    // navigation字体的颜色 大写 型号
    [self.navigationController.navigationBar setTitleTextAttributes: @{NSFontAttributeName: [UIFont fontWithName:@"Arial-BoldItalicMT" size:19],
                                                                       
                                                                       
                                                                       NSForegroundColorAttributeName:[UIColor whiteColor]}];
    self.navigationController.navigationBar.barTintColor = [UIColor colorWithRed:0.164 green:0.657 blue:0.915 alpha:1.000];

    
    
    _myImageView1 = [[UIImageView alloc] initWithFrame:CGRectMake(0, 64, KWIDTH, KHEIGHT / 4)];
    
    _myImageView1.image = [UIImage imageNamed:@"heartbeat"];
    
    [self.view addSubview:_myImageView1];
    
    _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 64 + KHEIGHT / 4, KWIDTH, KHEIGHT - 64) style:UITableViewStyleGrouped];
    _tableView.delegate = self;
    _tableView.dataSource = self;
    [self.view addSubview:_tableView];
    
    [_tableView registerClass:[MyCell class] forCellReuseIdentifier:@"cell"];
    
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 3;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    if (section == 0)
    {
        return 3;
    }
    return 1;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    MyCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell" forIndexPath:indexPath];
    
    switch (indexPath.section)
    {
        case 0:
            if (indexPath.row == 0)
            {
                cell.textLabel.text = @"       服药提醒";
                _myImageView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, 20, 20)];
                _myImageView.image = [UIImage imageNamed:@"naozhong"];
                [cell.contentView addSubview:_myImageView];
                
            }
            else if (indexPath.row == 1)
            {
                cell.textLabel.text = @"       推荐给朋友";
                _myImageView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, 20, 20)];
                _myImageView.image = [UIImage imageNamed:@"yisheng"];
                [cell.contentView addSubview:_myImageView];
            }
            else
            {
                cell.textLabel.text = @"       给软件评分";
                _myImageView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, 20, 20)];
                _myImageView.image = [UIImage imageNamed:@"pingfen"];
                [cell.contentView addSubview:_myImageView];
            }
            break;
        case 1:
            cell.textLabel.text = @"       我的收藏";
            _myImageView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, 20, 20)];
            _myImageView.image = [UIImage imageNamed:@"shoucang"];
            [cell.contentView addSubview:_myImageView];
            break;
        case 2:
            cell.textLabel.text = @"       关于我们";
            _myImageView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, 20, 20)];
            _myImageView.image = [UIImage imageNamed:@"guanyu"];
            [cell.contentView addSubview:_myImageView];
            break;
            
        default:
            break;
    }
    
    
    cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
    
    return cell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return 20;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 35;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    switch (indexPath.section)
    {
        case 0:
            if (indexPath.row == 0)
            {
                RemindViewController *remindVC= [[RemindViewController alloc] init];
                
                [self.navigationController pushViewController:remindVC animated:YES];
            }
            else if (indexPath.row == 1)
            {
                
            }
            else
                
                break;
        case 1:
            
            break;
        case 2:
        {
            AboutViewController *aboutVC = [[AboutViewController alloc] init];
            
            [self.navigationController pushViewController:aboutVC animated:YES];
        }
            break;
            
        default:
            break;
    }
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
 #pragma mark - Navigation
 
 // In a storyboard-based application, you will often want to do a little preparation before navigation
 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
 // Get the new view controller using [segue destinationViewController].
 // Pass the selected object to the new view controller.
 }
 */

@end

